package demo1;

/**
 * @Author liangzai
 * @Description:
 */
public class Training {
    public int generateKey(int num1, int num2, int num3) {
        int[][] map = new int[3][4];
        map[0] = process(num1);
        map[1] = process(num2);
        map[2] = process(num3);
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 4; i++) {
            int temp = Math.min(Math.min(map[0][i], map[1][i]), map[2][i]);
            sb.append(temp);
        }
        return Integer.valueOf(sb.toString());
    }

    public int[] process(int m) {
        int[] map = new int[4];
        int index = 3;
        while (m > 0) {
            map[index--] = m % 10;
            m /= 10;
        }
        return map;
    }
}
